var demo = document.getElementById("demo");
var demo1 = document.getElementById("demo1");
var demo2 = document.getElementById("demo2");
var speed=30;
var i=0;
var MyMar;
demo2.innerHTML = demo1.innerHTML
 
function Marquee(){
	if(i==0)
	{
	clearInterval(MyMar)
	MyMar = setInterval(Marquee,speed)
	}    
	   			
    if(demo2.offsetTop-demo.scrollTop<=0)
    {
    demo.scrollTop-=demo1.offsetHeight	
	}    
    else{
        demo.scrollTop+=1
	i=i+1
    }	
    if(i%mainHeight==0)
        {
	clearInterval(MyMar)
	MyMar = setInterval(Marquee,8000)
	i=0
	}	
}
MyMar = setInterval(Marquee,8000);        
demo.onmouseover = function(){clearInterval(MyMar)}    
demo.onmouseout = function(){MyMar = setInterval(Marquee,speed)} 